package com.ceba.test.modules.signvisual.entity;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.ceba.test.base.configs.CebaPathUtil;


/**
 * 手写签名数据bean
 * @author Administrator
 *
 */
public class HandWriteSign implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3294960149445914698L;
	public static String IMGPATHDIR="handWriteSign";
	public static String IMAGEIMGPATHDIR=".png";
	
	//-------------以下字段关键字段-----------------
	//session id
	private String sessionid;
	//编号
	private String number;
	//序号
	private String serialNumber;
	//base64
	private String base64;
	//imgPath 图片绝对路径
	private String imgPath;
	
	
	//-------------以下字段非关键字段-----------------
	private boolean isResponse=false;//是否返回过
	private String userid;//是否返回过
	
	
	
	
	
	public String getUserid() {
		return userid;
	}
	public void setUserid(String userid) {
		this.userid = userid;
	}
	public boolean isResponse() {
		return isResponse;
	}
	public void setResponse(boolean isResponse) {
		this.isResponse = isResponse;
	}
	public String getBase64() {
		return base64;
	}
	public void setBase64(String base64) {
		this.base64 = base64;
	}
	public String getSessionid() {
		return sessionid;
	}
	public void setSessionid(String sessionid) {
		this.sessionid = sessionid;
	}
	public String getNumber() {
		return number;
	}
	public void setNumber(String number) {
		this.number = number;
	}
	public String getSerialNumber() {
		return serialNumber;
	}
	public void setSerialNumber(String serialNumber) {
		this.serialNumber = serialNumber;
	}

//	public String getImgPath() {
//		imgPath=getHandWritSignDirPath()+number+serialNumber+IMAGEIMGPATHDIR;
//		return imgPath;
//	}
	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}
	
//	public static String getHandWritSignDirPath(){
//		return CebaPathUtil.getPhysicalPicFolder();
//	}
	/**
	 * 取得图片相对路径
	 * @return
	 */
	public String getImgPathRelative(){
		return CebaPathUtil.getProjectContextPath()+CebaPathUtil.getVirtualPicPath()+number+serialNumber+IMAGEIMGPATHDIR;
	}
	/**
	 * 取得base64净化数据
	 * @return
	 */
	public String getBase64PurifyData(){
		String[] base64s=StringUtils.split(base64,",");
		if(base64s.length == 2){
			return base64s[1];
		}
		return null;
	}
	/**
	 * 取得返回结果
	 * @return
	 */
	public Map<String, String> getResponseMap(){
		Map<String, String> map=new HashMap<>();
		map.put("imgPathRelative", getImgPathRelative());
		map.put("serialNumber", serialNumber);
		map.put("number", number);
		map.put("sessionid", sessionid);
		return map;
	}
	
}
